<?php
/**
 * Zend Framework application
 *
 * @category     Application
 * @package      Admin
 * @subpackage   ViewHelper
 * @author       Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright    Copyright (c) 2010 Krzysztof Kardasz
 */

/**
 * Węzeł
 *
 * @category     Application
 * @package      Admin
 * @subpackage   ViewHelper
 * @author       Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright    Copyright (c) 2010 Krzysztof Kardasz
 * @version 	 1.0
 */
class Hesperos_View_Helper_MetaData extends Zend_View_Helper_Abstract
{
    /**
     * Zwraca instancję obiektu
     *
     * @param  Zend_Db_Table_Row_Abstract $row
     * @return Admin_View_Helper_Node
     */
    public function metaData ()
    {
        $title       = Hesperos_Config_Manager::get('site', $this->view->l10n()->getLanguage())->meta_title;
        $description = Hesperos_Config_Manager::get('site', $this->view->l10n()->getLanguage())->meta_description;
        $keywords    = Hesperos_Config_Manager::get('site', $this->view->l10n()->getLanguage())->meta_keywords;

        if(!empty($title) && $this->view->headTitle()->count() == 0) {
            $this->view->headTitle($title);
        }

        if(!empty($description)) {
            $this->view->headMeta()->appendName('description',  $description);
        }

        if(!empty($keywords)) {
            $this->view->headMeta()->appendName('keywords',  $keywords);
        }
    }
}